from django.contrib import admin
from django.urls import path
from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers
from . import views

urlpatterns = [
    path('admin/', admin.site.urls),
    # 用户注册的路由
    path('users/', views.UsersView.as_view()),
    # 判断用户名的路由
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.UsernameCountView.as_view()),
    # 判断手机号的路由
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 内部认证代码还是Django  登录成功生成token
    url(r'^authorizations/$', obtain_jwt_token),
    #展示单一用户信息的路由
    path('user/', views.UserDetailView.as_view()),
    #更新邮箱
    path('email/', views.EmailView.as_view()),
    path('emails/verification/',views.EmailVerifyView.as_view())

]
router = routers.DefaultRouter()
router.register(r'addresses', views.AddressViewSet, base_name='addresses')

urlpatterns += router.urls